﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;

namespace NMF.Languages
{
    public abstract class Class : Type
    {
        public abstract IEnumerable<Property> GetProperties();

        public abstract IEnumerable<Class> GetBaseTypes();

        public abstract TypeSystem TypeSystem { get; }

        public abstract void AssertIsAssignableFrom(Class baseClass);

        public abstract Property GetProperty(string name);

        public abstract object CreateInstance();

        protected virtual void OnInstanceCreated(EventArgs e)
        {
            if (InstanceCreated != null) InstanceCreated(this, e);
        }

        public event EventHandler InstanceCreated;

        public sealed override void Visit(ITypeVisitor visitor)
        {
            visitor.VisitClass(this);
        }

        public sealed override T Visit<T>(ITypeVisitor<T> visitor)
        {
            return visitor.VisitClass(this);
        }

        public sealed override T Visit<S, T>(ITypeVisitor<S, T> visitor, S parameter)
        {
            return visitor.VisitClass(this, parameter);
        }
    }
}
